<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位居中</title>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    /* 定位居中 */
    /* 1. 绝对定位 */
    /* 2. 偏移量为负的一半 */
    /* 3. 元素的宽度和高度要设置 */
    img{
        position: absolute;
        top: 50%;
        left: 50%;

        /* margin-left: -265px;
        margin-top: -127px; */

        transform: translate(-50%,-50%);
    }


</style>
<body>
    <div>
        <img src="./login.webp" alt="">
        
    </div>

</body>
</html>